All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.servlet.util.Pool

java.lang.Object
   |
   +----sun.servlet.util.Pool

public class Pool
extends Object
This class implements a simple resource allocation pool for storing reusable objects.


Variable Index

 o cl
The Class used to create new objects.
 o count
The current number of available objects.
 o free
The list of available objects.

Constructor Index

 o Pool(Class)
Creates a new allocation pool for the specified Class.
 o Pool(Class, int)
Creates a new allocation pool for the specified Class.
 o Pool(String)
Creates a new allocation pool for the specified class name.
 o Pool(String, int)
Creates a new allocation pool for the specified class name.

Method Index

 o alloc()
Returns a new object from the allocation pool.
 o free(Object)
Returns an object to the free list.
 o init(Class)
Initializes allocation pool for the specified Class.

Variables

 o cl
 protected Class cl
The Class used to create new objects.

 o free
 protected Object free[]
The list of available objects.

 o count
 protected int count
The current number of available objects.

Constructors

 o Pool
 public Pool(String name,
             int count) throws IllegalArgumentException
Creates a new allocation pool for the specified class name.

Parameters:
name - the name of the class used for creating new objects
count - the initial size of the allocation pool
Throws: IllegalArgumentException
if the class could not be found, could not be instantiated, or the class or initializer is not accessible
 o Pool
 public Pool(String name) throws IllegalArgumentException
Creates a new allocation pool for the specified class name.

Parameters:
name - the name of the class used for creating new objects
Throws: IllegalArgumentException
if the class could not be found, could not be instantiated, or the class or initializer is not accessible
 o Pool
 public Pool(Class cl,
             int count) throws IllegalArgumentException
Creates a new allocation pool for the specified Class.

Parameters:
cl - the Class used for creating new objects
Throws: IllegalArgumentException
if the class could not be instantiated, or the class or initializer is not accessible
 o Pool
 public Pool(Class cl) throws IllegalArgumentException
Creates a new allocation pool for the specified Class.

Parameters:
cl - the Class used for creating new objects
Throws: IllegalArgumentException
if the class could not be instantiated, or the class or initializer is not accessible

Methods

 o init
 protected void init(Class cl) throws IllegalArgumentException
Initializes allocation pool for the specified Class.

Parameters:
cl - the Class used for creating new objects
Throws: IllegalArgumentException
if the class could not be instantiated, or the class or initializer is not accessible
 o alloc
 public Object alloc()
Returns a new object from the allocation pool. If an object is not currently available from the free list, then a new one will be created using the Class specified in the constructor.

 o free
 public synchronized void free(Object obj)
Returns an object to the free list. The object must be an instance of the Class specified when the pool was created.

Parameters:
obj - the object to be freed

All Packages  Class Hierarchy  This Package  Previous  Next  Index